package com.wolfman.wolfchat.utils;


import com.wolfman.wolfchat.po.User;

/**
 * @Title
 * @Description
 * @Author WolfMan
 * @Date 2022/1/15 0:42
 * @Email 2370032534@qq.com
 */
public class ThreadLocalUtil {

    private final static ThreadLocal<User> userThreadLocal = new ThreadLocal<>();

    /**
     * 获取线程中的用户
     *
     * @return
     */
    public static User getUser() {
        return userThreadLocal.get();
    }

    /**
     * 设置当前线程中的用户
     *
     * @param user
     */
    public static void setUser(User user) {
        userThreadLocal.set(user);
    }

}
